home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Language/OS - Multiplatform Resource Library
/
LANGUAGE OS.iso
/
oper_sys
/
choices
/
choicess.lha
/
Name.c
< prev
next >
Wrap
C/C++ Source or Header
|
1989-02-06
|
2KB
|
72 lines
/*
* This file is part of the Choices Operating System Simulator
* Developed by: The TAPESTRY Parallel Computing Laboratory
* University of Illinois at Urbana-Champaign
* Department of Computer Science
* 1304 W. Springfield Ave.
* Urbana, IL 61801
*
* Copyright (c) 1987, 1988, 1989 The University of Illinois Board of Trustees.
* All Rights Reserved.
* CONFIDENTIAL INFORMATION. Distribution restricted under license agreement.
*
* Author: Gary M. Johnston (johnston@cs.uiuc.edu)
* Project Manager and Principal Investigator: Roy Campbell (roy@cs.uiuc.edu)
*
* Funded by: NSF TAPESTRY Grant No. 1-5-30035, NASA ICLASS Grant
* No. 1-5-25469 and No. NSG1471 and AT&T Metronet Grant No. 1-5-37411.
*/
/*
* Name.c - Common instance name creation routines.
*
* $Header: Name.c,v 1.1 88/02/12 18:19:39 johnston Exp $
* $Locker: johnston $
*/
#include <stdio.h>
#include <string.h>
#include "Assert.h"
#include "Name.h"
char *
MakeName(char * prefix, void * address)
{
/*
* Create and return string "<prefix>[<hexaddress>]".
*/
Assert(prefix != 0);
Assert(address != 0);
char * buffer = "0x00000000";
sprintf( buffer, "0x%08x", address );
char * left = "[";
char * right = "]";
char * name = new char [ strlen( prefix ) +
strlen( left ) +
strlen( buffer ) +
strlen( right ) +
1 ];
Assert(name != 0);
strcpy( name, prefix );
strcat( name, left );
strcat( name, buffer );
strcat( name, right );
return( name );
}
char *
CatName( char * one, char * two )
{
/*
* Concatenate two names.
*/
Assert(one != 0);
Assert(two != 0);
char * name = new char [ strlen(one) + strlen(two) + 1 ];
Assert(name != 0);
strcpy( name, one );
strcat( name, two );
return (name);
}